<!DOCTYPE html>
<html>
    <body>
        <form action="/form" th:action="@{/form}" th:object="${user}" method="post">
            <table>
                <tr>
                    <td>姓名:</td>
                    <td><input type="text" th:field="*{name}" /></td>
                    <td th:if="${#fields.hasErrors('name')}" th:errors="*{name}">名字长度限制2~15</td>
                </tr>
                <tr>
                    <td>年龄:</td>
                    <td><input type="text" th:field="*{age}" /></td>
                    <td th:if="${#fields.hasErrors('age')}" th:errors="*{age}">年纪至少18岁~</td>
                </tr>
                <tr>
                    <td><button type="submit">登录一下</button></td>
                </tr>
            </table>
        </form>
    </body>
</html>